<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib  prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<!DOCTYPE HTML>
<html>
	<head>
		<base href="${pageContext.request.contextPath}/">
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">

        <title>系统菜单管理</title>

        <link href="resource/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
        <link href="resource/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
        <link href="resource/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
        <link href="resource/admin/css/animate.css" rel="stylesheet">
        <link href="resource/admin/css/style.css?v=4.1.0" rel="stylesheet">
    </head>
    <body >
    <!-- 定义行数 -->
    <div class="row">
        <!-- 定义列数 -->
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <!-- 定义内容 -->
                <div class="ibox-content" style="border-style: none;">
                    <form method="post" class="form-horizontal" action="sys/menu/update">
                    <c:if test="${requestScope.type eq 'child' }" var="flag">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">父菜单</label>
                            <div class="col-sm-6">
                                <select class="form-control m-b" name="parent_id" id="parent_id">
                                    <c:forEach items="${requestScope.parentNodeList }" var="parent">
                                        <option value="${parent.menu_id }">${parent.menu_name }</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                    </c:if>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">节点名称</label>
                            <div class="col-sm-6">
                                <input type="text" class="form-control" name="menu_name" id="menu_name" placeholder="请输入节点名称" autofocus
                                value="${requestScope.menu.menu_name }"
                                >
                            </div>
                        </div>
                        <c:if test="${flag }">
                            <div class="form-group">
	                            <label class="col-sm-3 control-label">访问路径</label>
	                            <div class="col-sm-6">
	                                <input type="text" class="form-control" name="url" id="url" placeholder="请设置访问路径" value="${requestScope.menu.url }">
	                            </div>
                            </div>
                        </c:if>
                        
                        <div class="form-group">
                            <label class="col-sm-3 control-label">图标设置</label>
                            <div class="col-sm-6">
                                <input type="text" class="form-control" name="icon" id="icon" placeholder="请设置节点图标" value="${requestScope.menu.icon }">
                            </div>
                        </div>


                        <div class="form-group">
                            <div class="col-sm-6 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit">更新节点</button>
                                <button class="btn btn-default" type="reset">取消</button>
                            </div>
                        </div>
                        <%--隐藏域 --%>
                        <input type="hidden" name="menu_id" value="${requestScope.menu.menu_id }" >
                        <input type="hidden" name="_method" value="put">
                    </form>
                </div>
            </div>
        </div>

    </div>

        <!-- 全局js -->
        <script src="resource/admin/js/jquery.min.js?v=2.1.4"></script>
        <script src="resource/admin/js/bootstrap.min.js?v=3.3.6"></script>

        <!-- 自定义js -->
        <script src="resource/admin/js/content.js?v=1.0.0"></script>
        <c:if test="${flag }">
            <script type="text/javascript">
            var parent_id = '${requestScope.menu.parent_id}';
            $("#parent_id").val(parent_id);
            </script>
        </c:if>

    </body>
</html>